package study.saas.order.service;

import study.saas.common.facade.BaseFacade;
import study.saas.common.viewmodel.ApiResultV2;
import study.saas.common.viewmodel.PageModel;
import study.saas.order.entity.Commodity;
import study.saas.order.service.model.CommodityFiterDTO;
import study.saas.order.service.model.CommodityModifyDTO;

import java.util.List;

/**
 * @author RivenChen
 */
public interface CommodityFacade extends BaseFacade<Commodity> {
    /**
     * 添加商品
     */
    ApiResultV2<Commodity> addCommodity(CommodityModifyDTO commodity);

    /**
     * 商品修改
     */
    ApiResultV2<Commodity> setCommodity(CommodityModifyDTO commodity);

    /**
     * 查询商品详情
     */
    ApiResultV2<Commodity> findCommodity(String commodityName);

    /**
     * 商品分页详情
     */
    ApiResultV2<PageModel<Commodity>> list(CommodityFiterDTO filter);

    /**
     * 上架商品/下架商品
     */
    ApiResultV2<Commodity> setClass(Integer state);

    /**
     * 修改商品数量
     */
    ApiResultV2<Commodity> decreaseCommodity(String commodityName);

    /**
     * 删除商品
     */
    ApiResultV2<Commodity> deleteCommodity(String commodityName);

    /**
     * 修改商品数量
     */
    ApiResultV2 setAmount(Boolean flag, String commodityName, Integer num);

}
